<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.pojo.User"%>
<%@page import="com.Dao.UserDao"%>
<%
	request.setCharacterEncoding("UTF-8");
	String userName = request.getParameter("userName");
	String userPhone = request.getParameter("userPhone");
	String userEmail = request.getParameter("userEmail");
	String userPsw = request.getParameter("userPsw");
	String reuserPsw = request.getParameter("reuserPsw");
	//判断是否已经存在此分类
	User user = new User(userName,userPhone,userEmail,userPsw,reuserPsw);
	//3、创建UserDao对象
	Integer countn = (Integer)session.getAttribute("countn");
	if(null == countn){
		countn = 0;
	}
	countn = 0;
	UserDao userDao = new UserDao();
	boolean flag = userDao
		.findUserByBC(user); 
	if(flag == false){//没有则把分类放入数据库
		Integer result = userDao.save(user);
	    countn=1;
	}
	else{
		countn=2;
	}
	session.setAttribute("countn",countn);
	//4、执行数据库存储操作
	
	//5、跳转到注册页面
	response.sendRedirect("../login/register.jsp");
%>
